package com.txby.start;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import com.jck.mybatis.mapper.MybatisBaseDaoCRUD;
import com.txby.hisJob.component.job.StartUpCancelOrderJobTask;
import com.txby.hisJob.component.job.StartUpCloseOrderJobTask;
import com.txby.hisJob.component.job.StartUpConfirmOrderJobTask;
import com.txby.hisJob.component.util.QuartzFactoryUtil;

@Component
@Order(value = 1)
public class CusApplicationRunner implements ApplicationRunner{

	@Resource(name = "mybatisBaseDaoCRUD")
	public MybatisBaseDaoCRUD mBaseDao;
    @Override
    public void run(ApplicationArguments var1) throws Exception{
//        System.out.println(mBaseDao.findBySql("select * from t_txby_sp_visitorUser", null, null));
        Map map=new HashMap();
        map.put("mBaseDao", mBaseDao);
//        System.out.println( SpringContextUtils.getAlipayTradeUtil().getNotify_url());
        //重启时加入任务线程处理，30分未支付取消
 /*       QuartzFactoryUtil.getInstance().addJobByCalendar(StartUpCancelOrderJobTask.defaultJobName,StartUpCancelOrderJobTask.defaultJobName, StartUpCancelOrderJobTask.class,1, map);
        //？重启时加入任务线程处理，（已支付）21天自动确认收货，更新状态
        
        QuartzFactoryUtil.getInstance().addJobByCalendar(StartUpConfirmOrderJobTask.defaultJobName,StartUpConfirmOrderJobTask.defaultJobName, StartUpConfirmOrderJobTask.class,1, map);

        //？重启时加入任务线程处理，(已完成、已确认收货 ）30天自动关闭订单建议
        QuartzFactoryUtil.getInstance().addJobByCalendar(StartUpCloseOrderJobTask.defaultJobName,StartUpCloseOrderJobTask.defaultJobName, StartUpCloseOrderJobTask.class,1, map);
      */  
        
        
    }
    
    

}